﻿
var _py = _py || [];
var _paq = _paq || [];
//加入购物车
function DSPGoForAddCart(productid,addcount) {
    _paq.push(["setCustomVariable", 1, "addToCart", productid+":"+addcount, "page"]);
}

$(function () {
    var ulgnf = window.Cookies("Ulgnf").val();
    var cus = window.Cookies("ZDCustomerLogin").val();
    var ushoped = window.Cookies("is_gm").val();
    var ulCount = window.Cookies("Ulgnc").val();

    //piwik
    if (ulgnf && cus) {
        _paq.push(["setUserId", cus])
    }
    else {
        _paq.push(["setUserId", "0"])
    }

    //IPinYou 
    var uType = 1;
    ulCount = parseInt(ulCount);
    //IPinYou 1-未注册未购买 2-已注册未购买 3-已注册已购买超过一个月未到访 4-已注册已购买1个月到访少于4次 5-已注册已购买一个月到访大于等于4次
    if (cus)
    {
        if (ushoped && ushoped == "1"){
            if (ulCount) {
                if (ulCount < 4)
                    uType = 4;
                else
                    uType = 5;
            }
            else
                uType = 3;
        }
        else{
            uType = 2;
        }
    }
    _py.push(['a', 'QPs..gxwegLhxJkxLSwhT0MlYh_']);
    _py.push(['domain', 'stats.ipinyou.com']);
    _py.push(['e', '']);
    _py.push(['pv', uType]);
    -function (d) {
        var s = d.createElement('script'),
        e = d.body.getElementsByTagName('script')[0]; e.parentNode.insertBefore(s, e),
        f = 'https:' == location.protocol;
        s.src = (f ? 'https' : 'http') + '://' + (f ? 'fm.ipinyou.com' : 'fm.p0y.cn') + '/j/adv.js';
    }(document);
    //IPinYou 

});

